package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.dubbo.mapper.AnnouncementMapper;
import com.tanhua.model.domain.Announcement;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class AnnouncementApiImpl implements AnnouncementApi{

    @Autowired
    private AnnouncementMapper announcementMapper;

    /**
     * 查询所有公告
     *
     * @param page
     * @param pagesize
     * @return
     */
    @Override
    public IPage<Announcement> findAll(int page, int pagesize) {
        //创建分页构造器
        Page<Announcement> announcementPage = new Page<>(page,pagesize);
        announcementMapper.selectPage(announcementPage,Wrappers.emptyWrapper());
        return announcementPage;
    }
}
